TIFF: add support for FillOrder == 2 #2936
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See https://trac.openmicroscopy.org/ome/ticket/4166
This updates
TiffParser
to useInteger.reverse(int)
to reverse the bits in each byte of a tile when theFillOrder
tag is set to 2. The reversal is performed immediately after the tile buffer is read from the file, before any decompression or unpacking takes place. An extra check is added to the tile reading logic, so that the special case of returning a single raw tile is never used forFillOrder == 2
.This is a much simpler approach than either of the fixes proposed on the ticket, as it does not require any additional API or changes to other components. It should be safe for a patch release, but is not urgent and can be deferred if needed.
To test, use the
data_repo/curated/tiff/john/C100915-MA_AXIS_LEH_IMAGE_KIND_FLAT_ICE_3.tif
file. Without this change,showinf
should result in an image with vertical black and white pinstripes. With this change,showinf
should show a smooth gradient, matching the results of ImageMagick'sdisplay
command.